package com.woniuxy.utils;

import lombok.Data;

@Data
public class Result<T> {
    private Boolean flag;
    private Integer code;
    private String message;
    private T data;


    public static Result success(Integer code, String message, Object data){
        Result result = new Result();
        result.setFlag(true);
        result.setCode(code);
        result.setMessage(message);
        result.setData(data);
        return result;
    }

    public static Result fail(Integer code, String message, Object data){
        Result result = new Result();
        result.setFlag(false);
        result.setCode(code);
        result.setMessage(message);
        result.setData(data);
        return result;
    }

}
